<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // let arr = ["坤坤", "giao哥", "刀哥", "小亮", "虎弟", "杰哥"]
    // let i = Math.floor(Math.random() * (arr.length))
    // console.log(arr[i]);


    // let i = Math.floor(Math.random() + 2)
    // console.log(i);

    // let i = Math.random() + 2
    // console.log(i);

    let arr = ["坤坤", "giao哥", "刀哥", "小亮", "虎弟", "杰哥"]
    // 1. 先生成随机数
    let i = Math.floor(Math.random() * (arr.length))
    console.log(i);
    // 2. 现在页面展示抽取的数据
    console.log(arr[i])
    document.write(arr[i])
    // 3. 在数组中，把刚才抽取的数据给删除，避免重复抽取
    arr.splice(i, 1)
    console.log(arr);

  </script>
</body>

</html>